package com.cat.math;

import java.util.Arrays;

/**
 * @author 曲大人的喵
 * @description https://leetcode.cn/problems/rotate-array/?envType=problem-list-v2&envId=math
 * @create 2025/9/22 09:55
 * @since JDK17
 */

public class Solution02 {
    public void rotate(int[] nums, int k) {
        int n = nums.length;
        int[] arr = Arrays.copyOf(nums, n);
        for (int i = 0; i < n; i++) {
            nums[i] = arr[(i + n - k) % n];
        }
    }
}
